package com.songshuai.webapi.baseapi.common.enumerations;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public enum DicToOldDicName {

    //subject_name
    Subject_chinese_name(1003001, "语文"),

    Subject_chemistry_name(1003003, "化学"),

    Subject_english_name(1003004, "英语"),

    Subject_math_name(1003002, "数学"),

    Subject_other_name(1003006, "其他"),

    Subject_physics_name(1003005, "物理"),

    //grade_name
    Grade_one_name(1004001, "一年级"),

    Grade_two_name(1004002, "二年级"),

    Grade_three_name(1004003, "三年级"),

    Grade_four_name(1004004, "四年级"),

    Grade_five_name(1004005, "五年级"),

    Grade_six_name(1004006, "六年级"),

    Grade_six_two_name(1004006, "六年级"),

    Grade_seven_name(1004007, "七年级"),

    Grade_eight_name(1004008, "八年级"),

    Grade_nine_name(1004009, "九年级"),

    Grade_other_name(1004100, "其他"),

    //signup_status
    Signup_status_no(1028002, "不可报"),
    Signup_status_yes(1028001, "可报名"),

    //degree
    Degree_bechelor_name(133, "本科"),
    Degree_doctor_name(135, "博士"),
    Degree_junior_name(131, "大专"),
    Degree_master_name(134, "硕士"),

    //teacher_lv
    Teacher_lv_common_name(235, "普通"),
    Teacher_lv_common_one_name(234, "普通1"),
    Teacher_lv_senior_name(233, "高级"),
    Teacher_lv_start_one_name(232, "明星一级"),
    Teacher_lv_star_two_name(231, "明星二级"),
    Teacher_lv_star_three_name(230, "明星三级"),

    //job_status
    Job_status_dimission_name(713, "离职"),
    Job_status_practice_name(300, "实习"),
    Job_status_probation_name(548, "试用期"),
    Job_status_regular_name(306, "正式"),
    //Job_status_vacation(231, "vacation"), 休假

    // edition_name
    Edition_beishi_name(1025007, "北师版"),

    Edition_hujiao_name(1025006, "沪教版"),

    Edition_huke_name(1025005, "沪科版"),

    Edition_other_name(1025008, "其他"),

    Edition_renjiao_name(1025004, "人教版"),

    Edition_sujiao_name(1025003, "苏教版"),

    Edition_waijun_name(1025002, "外研版"),

    Edition_zhejiao_name(1025001, "浙教版");


    private int code;
    private String msg;

    DicToOldDicName(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static int getCode(String define) {
        try {
            return DicToOldDicName.valueOf(define).code;
        } catch (IllegalArgumentException e) {
            log.error("undefined error code: {}", define);
            return 0;
        }
    }

    public static String getMsg(String define) {
        try {
            return DicToOldDicName.valueOf(define).msg;
        } catch (IllegalArgumentException e) {
            log.error("undefined error code: {}", define);
            return "";
        }
    }

    public static String getMsg(Integer code) {
        if (code == null || code <= 0)
            return "";
        for (DicToOldDicName err : DicToOldDicName.values()) {
            if (err.code == code) {
                return err.msg;
            }
        }
        return "";
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
